package com.example.neartweet;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

import android.os.AsyncTask;

public class SendTask extends AsyncTask<String, Void, Integer>{
	
	private Socket client;
	private PrintWriter pw;

	@Override
	protected Integer doInBackground(String... params) {

		if(params.length <= 0){
			return 0;
		}
		
		try {
			client = new Socket("194.210.223.101", 8015);
			pw = new PrintWriter(client.getOutputStream(), true);
			pw.write(params[0]);
			pw.flush();
			pw.close();
			client.close();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return 0;
	}
	
	protected void onPostExecute(Long result) {
		return;
	}

}
